package edu.uniquindio.prmaven.proyectofinal;

import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;
import org.testng.Assert;
import org.testng.annotations.Test;

import edu.uniquindio.prmaven.general.TestCore;

public class CalendarioMask extends TestCore {
	
	@Test()
	/**
	dataProviderClass = edu.uniquindio.prmaven.dataprovider.DataProviderFactory.class, 
	dataProvider = ConfigurationConstants.DP_FACTORY
	@DataProviderArguments(ConfigurationConstants.ESCENARIO
			+ ConfigurationConstants.EQUALS + DataProvidersConstants.HOJA_1)
			**/
	
	public void testCalendarioMask() throws Exception {
		
		try {
			
			selenium.open("/showcase/");
			
			//selenium.click("id=SubMenu-Input"); Seleccionar menu Input
			WebElement menuInput=driver.findElement(By.id("SubMenu-Input"));
			menuInput.click();
			
			//selenium.click(".//*[@id='MENUSIDEindent']/div[3]/a[5]"); Seleccionar Submenu Calendar
			WebElement submenuCalendar=driver.findElement(By.xpath
					("//*[@id='MENUSIDEindent']/div[3]/a[5]"));
			submenuCalendar.click();
			
			selenium.waitForPageToLoad("30000");
			
			//selenium.click("id=form:mask_input"); Seleccionar campo Mask
			WebElement campoMask=driver.findElement(By.id("form:mask_input"));
			campoMask.click();
			
			//selenium.click("//div[@id='ui-datepicker-div']/div/a[2]"); Seleccionar Mes
			WebElement seleccion=driver.findElement(By.xpath("//div[@id='ui-datepicker-div']/div/a[2]"));
			seleccion.click();
			
			//selenium.click("css=a.ui-state-default.ui-state-hover"); Seleccionar fecha
			WebElement seleccionDef=driver.findElement(By.cssSelector("a.ui-state-default.ui-state-hover"));
			seleccionDef.click();
			
			//selenium.click("id=form:j_idt100"); //*[@id='form:j_idt100'] Click boton 
			WebElement boton=driver.findElement(By.xpath("//*[@id='form:j_idt100']"));
			boton.click();
		
			Assert.assertEquals(selenium.getText("css=div.ui-dialog-content.ui-widget-content"), 
				"Inline:Popup:Button:Event:German:Restricted:Multiple:Effect:Mask:12/10/2014Datetime:Time:");

					
		}catch(AssertionError e){
		System.out.println("no se encontro texto");
	}finally{
		
	}
}

}